{% extends "shop/base.html" %}
{% load i18n %}

{% block pagetitle %}Login{% endblock %}
{% block bodyclass %}login{% endblock %}
{% block bodyid %}login{% endblock %}

{% block navbar %}
   <li class="first"><a href="{{ shop_base }}/">{% trans "Home" %}</a></li>
{% endblock %}

{% block content %}
<h4>{% trans "Login, or sign up to the store" %}</h4>

<form name="loginform" method="post" action="{% url auth_login %}">
<input type="hidden" name="next" value="{% if next %}{{ next }}{% else %}{% url satchmo_account_info %}{% endif %}" />
<input type="hidden" name="action" value="login" />    
<table class="form" style="float:left; width: 50%">
    <thead>
        <tr>
            <th colspan="2" class="label"><b>{% trans 'Existing members login' %}</b></th>
        </tr>
    </thead>
    <tbody>
        {% if loginform.non_field_errors %}
            <tr><td class="warn" colspan="2">
				{{ loginform.non_field_errors }}
            </td></tr>
        {% endif %}
        <tr>
            <td class="label">
                <label for="id_username">{% trans "Email Address:" %}</label>
            </td>
            <td class="text">
                {{loginform.username }}
            </td>
        </tr>
        {% if loginform.username.errors %}<tr><td colspan="2">{{ loginform.username.errors|join:", " }}</td></tr>{% endif %}
        <tr>
            <td class="label">
                <label for="id_password">{% trans "Password:" %}</label>
            </td>
            <td class="text">
                {{loginform.password }}
            </td>
        </tr>
        {% if loginform.password.errors %}<tr><td colspan="2">{{ loginform.password.errors|join:", " }}</td></tr>{% endif %}
        <tr>
            <td colspan="2" class="button">
				<input type="submit" name="login" value="{% trans 'Login' %}" />
            </td>
        </tr>
    </tbody>
</table>
</form>
		
<form name="createform" method="post" action="{% url auth_login %}">
<input type="hidden" name="action" value="create" />
<input type="hidden" name="next" value="{% if next %}{{ next }}{% else %}{% url satchmo_account_info %}{% endif %}" />
<table class="form nohead">
    <thead>
        <tr>
            <th colspan="2" class="label"><b>{% trans 'New Members, Create Your Account Below' %}</b></th>
        </tr>
    </thead>
    <tbody>
        {% if createform.has_errors %}
            <tr><td class="warn" colspan="2">
                {% blocktrans count createform.errors.items|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
            </td></tr>
        {% endif %}
        <tr><td class="label"><label for="id_email">Email Address:</label></td> <td class="text">{{ createform.email }}</td></tr>
        {% if createform.email.errors %}<tr><td>&nbsp;</td><td class="warn">*** {{ createform.email.errors|join:", " }}</td></tr>{% endif %}

        <tr><td class="label"><label for="id_first_name">First Name:</label></td><td class="text"> {{ createform.first_name }}</td></tr>
        {% if createform.first_name.errors %}<tr><td>&nbsp;</td><td class="warn">*** {{ createform.first_name.errors|join:", " }}</td></tr>{% endif %}

        <tr><td class="label"><label for="id_contents">Last Name:</label></td><td class="text"> {{ createform.last_name }}</td></tr>
        {% if createform.last_name.errors %}<tr><td>&nbsp;</td><td class="warn">*** {{ createform.last_name.errors|join:", " }}</td></tr>{% endif %}

        <tr><td class="label"><label for="id_password">Password:</label></td><td class="text"> {{ createform.password1 }}</td></tr>
        {% if createform.password.errors %}<tr><td>&nbsp;</td><td class="warn">*** {{ createform.password1.errors|join:", " }}</td></tr>{% endif %}

        <tr><td class="label"><label for="id_password2">Password (again):</label></td><td class="text"> {{ createform.password2 }}</td></tr>
        {% if createform.password2.errors %}<tr><td>&nbsp;</td><td class="warn">*** {{ createform.password2.errors|join:", " }}</td></tr>{% endif %}

        <tr><td colspan="2">{{ createform.newsletter }} <label for="id_newsletter">{% trans 'Sign me up for Email Updates about new products and special offers!' %}</label>
        </td>
        {% if createform.newsletter.errors %}<tr><td colspan="2" class="warn">*** {{ createform.newsletter.errors|join:", " }}</td></tr>{% endif %}   
        
        <tr>
            <td colspan="2" class="button">
                <input type="submit" name="create" value="{% trans 'Create' %}" />
            </td>
        </tr>
     </tbody>
</table>
</form>

{% endblock %}